#include <ilcplex/cplex.h>
#include <ctype.h>
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#include <math.h>
#include <time.h>
#include <sys/time.h>
#define MATHLIB_STANDALONE 
#include <Rmath.h>

struct bigminfo {
  int *flagPtr;
  int ni;  
  int ns;
  double stepsize;
  int nbigm;
  int *bigmrowind;
  int *bigmcolind;
  int *bigmchgind;
  int *lastnode;
  int *loopind;
  double *bigmval;  
  double *myBestObjValPtr;
};
typedef struct bigminfo  BIGMINFO, *BIGMINFOptr;

struct coninfo {
  int *flagPtr;
  int ncon;
  int *conind;
  int *conchgbdsind;
  int *loopind;
  int *lastnode;
};
typedef struct coninfo CONINFO, *CONINFOptr;

int CPXPUBLIC DZcallbackcheckconbds      
(
 CPXCENVptr   env,
 void         *cbdata,
 int          wherefrom,
 void         *cbhandle,
 int          *useraction_p
 );   

int CPXPUBLIC DZcallbacksetbigm      
(
 CPXCENVptr   env,
 void         *cbdata,
 int          wherefrom,
 void         *cbhandle,
 int          *useraction_p
 );   


int DZpopulatemod(CPXENVptr env, CPXLPptr lp, int ni, int ns, double eps);

int DZgetbigmind(CPXENVptr env, CPXLPptr lp, int **bigmrowind_p, int **bigmcolind_p, int **bigmchgind_p);
int DZprintbigmval(CPXENVptr env, CPXLPptr lp, int *bigmrowind, int *bigmcolind);
int DZsetbigmval(CPXENVptr env, CPXLPptr lp, int *bigmrowind, int *bigmcolind);
int DZgetbigmval(CPXENVptr env, CPXLPptr lp, int *bigmrowind, int *bigmcolind, double *bigmval);
int DZchgbigmval(CPXENVptr env, CPXLPptr lp, int *bigmrowind, int *bigmcolind, int *bigmchgind);

/* Function to get continuous indices */
int DZsetconbds(CPXENVptr env, CPXLPptr lp, CONINFOptr cp);
int DZgetconind(CPXENVptr env, CPXLPptr lp, CONINFOptr cp);
int DZchgconbds(CPXENVptr env, CPXLPptr lp, CONINFOptr cp);
